<?php
class SomeClass {}
interface SomeInterface {}
trait SomeTrait {}


// 匿名类
new class(10) extends SomeClass implements SomeInterface {
    use SomeTrait;


    public function __construct(private readonly int $num)  {

        echo $num;
    }
};

class Outer {


    public function __construct(public readonly int $num) {

    }

    public function prop(){
        return new class($this->num) extends Outer {

            public function __construct(public readonly int $prop_num) {

            }

            public function prop2(): int{
                return $this->prop_num;
            }
        };
    }
}

$obj = new Outer(34);

echo $obj->prop()->prop2();







